/**
 * Captain
 * © 2018 Captain copyright，All rights reserved.
 * http://www.sccaptain.com.cn
 * 
 * JAVA : 8
 * 文  件  名: CommentController.java
 * 创  建  人: QinYoubin (qin.youbin@sccaptain.com.cn)
 * 创建时间: 2018年5月3日 上午11:27:23
 * 版         本: 1.0.0
 * 备         注:
 * 修订历史:
 */
package com.material.c2c.web.message.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cpt.framework.web.JsonResult;
import com.material.c2c.message.entity.YHLY;
import com.material.c2c.message.service.CommentService;
import com.material.c2c.web.user.model.QueryVO;
import com.material.c2c.web.util.ControllerUtil;

/**
 * 用户留言
 * @since 1.0
 * @version 1.0
 * @author QinYoubin (qin.youbin@sccaptain.com.cn)
 */
@RestController
@RequestMapping("/comment")
public class CommentController {
  @Resource
  private CommentService commentService;
  
  @PostMapping("/add")
  public JsonResult add(@RequestBody YHLY yhly) {
    return ControllerUtil.getResult(commentService.add(yhly));
  }
  @GetMapping("/delete/{id}")
  public JsonResult delete(@PathVariable String id) {
     return JsonResult.success(commentService.delete(id));
  }
  @PostMapping("/listByDdid")
  public JsonResult search(@RequestBody QueryVO vo) {
    return JsonResult.success(commentService.listByDdid(vo.getKey(), vo.getPageable()));
  }
}
